home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power CD-ROM!! 8
/
Power CD-ROM 8.iso
/
prgmming
/
pmd110
/
bbstrres.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-11-13
|
3KB
|
58 lines
(* This file was mangled by Mangler 1.35 (c) Copyright 1993-1994 by Berend de Boer *)
{ Created : 1993-03-06
Unit for handling string resources
Last changes :
94-05-16 Adapted to the Windows environment
}
{$IFDEF DPMI}
{$X+,S-}
{$ELSE}
{$X+,F+,O+,R-,Q-}
{$ENDIF}
unit BBStrRes;
interface
uses Objects;
{$IFNDEF Windows}
const
StrResBufSize:word = 4096;
Strings:PStringList = nil;
{$ENDIF}
{$IFNDEF Windows}
procedure LoadStrings;
procedure DoneStrings;
{$ENDIF}
function rsGet(sKey : word) : string;
function rsGet1(sKey : word; Param1 : longint) : string;
function rsGet2(sKey : word; Param1, Param2 : longint) : string;
IMPLEMENTATION USES {$IFDEF Windows}WINDOS , WINPROCS , {$ELSE}DOS , {$ENDIF}BBGUI , BBFILE , BBUTIL ;
{$IFNDEF Windows}CONST O1lOIl0IIIIO:PRESOURCEFILE=NIL ;{$ENDIF}{$IFNDEF Windows}PROCEDURE LOADSTRINGS ;VAR OIOO:DIRSTR;
OO0O:NAMESTR;OIOl:EXTSTR;BEGIN FSPLIT (PARAMSTR (0 ), OIOO , OO0O , OIOl );IF NOT FILEEXIST (OIOO + 'STRINGS.TVR')THEN
BEGIN PRINTERROR ('File '+ OIOO + ' STRINGS.TVR could not be found.', 0 );HALT (1 );END ;O1lOIl0IIIIO := NEW
(PRESOURCEFILE , INIT (NEW (PBUFSTREAM , INIT (OIOO + 'STRINGS.TVR', STOPENREAD , STRRESBUFSIZE ))));IF O1lOIl0IIIIO ^.
STREAM ^. STATUS =STOK THEN STRINGS := PSTRINGLIST (O1lOIl0IIIIO ^. GET ('Strings'));CASE O1lOIl0IIIIO ^. STREAM ^.
STATUS OF STOK :EXIT ;STGETERROR :PRINTERROR
('TStringList not registered. Unable to load Strings from resource file STRINGS.TVR.', 0 );STINITERROR :PRINTERROR
('Cannot initialize stream. Unable to load Strings from resource file STRINGS.TVR.', 0 );ELSE PRINTERROR
('Unable to load Strings from resource file STRINGS.TVR.', 0 );END ;HALT (1 );END ;PROCEDURE DONESTRINGS ;BEGIN DISPOSE
(STRINGS , DONE );DISPOSE (O1lOIl0IIIIO , DONE );STRINGS := NIL ;O1lOIl0IIIIO := NIL ;END ;
{$ENDIF}{$IFDEF Windows}FUNCTION RSGET (SKEY:WORD):STRING ;VAR OO1O:STRING ;OIO0O1I11lO:INTEGER;BEGIN OIO0O1I11lO :=
LOADSTRING (HINSTANCE , SKEY , @ OO1O [ 1 ] , 255 );OO1O [ 0 ] := CHR (OIO0O1I11lO );RSGET := OO1O ;END ;
{$ELSE}FUNCTION RSGET (SKEY:WORD):STRING ;BEGIN IF STRINGS =NIL THEN RSGET := '<strings not loaded!>'ELSE RSGET :=
STRINGS ^. GET (SKEY );END ;{$ENDIF}FUNCTION RSGET1 (SKEY:WORD;PARAM1:LONGINT):STRING ;VAR OO1O:STRING ;OO01:LONGINT;
BEGIN OO01 := PARAM1 ;FORMATSTR (OO1O , RSGET (SKEY ), OO01 );RSGET1 := OO1O ;END ;FUNCTION RSGET2 (SKEY:WORD;
PARAM1,PARAM2:LONGINT):STRING ;VAR OO1O,OO1l:STRING ;OO01:ARRAY [ 0 .. 1 ] OF LONGINT;BEGIN OO01 [ 0 ] := PARAM1 ;OO01 [
1 ] := PARAM2 ;OO1l := RSGET (SKEY );FORMATSTR (OO1O , OO1l , OO01 );RSGET2 := OO1O ;END ;END .